<template>
  <div class="cate-gory">
    <div class="header">
      <slot name="header"></slot>
    </div>

    <div class="list">
      <div class="item"
           v-for="item in datas"
           :key="item.id"
           @click="goDetail(item.id)">
        <img :src="item.list_pic_url"
             alt="">
        <div class="name">{{item.name}}</div>
        <div class="price">￥{{item.retail_price}}</div>
      </div>
      <div class="go-nav">
        <div class="name">
          <slot name="goname"></slot>
        </div>
        <img src="@/assets/image/goright.png"
             alt="">
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "CateGory",
  props: {
    datas: {
      type: Array
    }
  },
  components: {

  },
  data () {
    return {

    };
  },
  computed: {

  },
  created () {
    console.log(this.datas);
  },
  mounted () {

  },
  methods: {
    goDetail (val) {
      
       this.$router.push({ name: "GoodsDetail", params: { id: val } })
    }
  },
};
</script>

<style scoped lang="scss">
.cate-gory {
  width: 100%;
  .header {
    width: 100%;
    text-align: center;
    height: 50px;
    line-height: 50px;
    background-color: #f4f4f4;
    font-weight: bold;
  }
  .list {
    width: calc(100vw - 4px);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    background-color: #f4f4f4;

    .item {
      width: 180px;
      text-align: center;
      margin-bottom: 8px;
      background-color: #fff;
      height: 215px;
      img {
        width: 130px;
        height: 130px;
      }
      .name {
        text-align: left;
        margin-left: 10px;
      }
      .price {
        text-align: left;
        margin-left: 10px;
        margin-top: 20px;
      }
    }
    .go-nav {
      background-color: #fff;
      width: 180px;
      height: 215px;
      text-align: center;
      font-size: 16px;
      .name {
        margin-top: 40px;
      }
      img {
        width: 36px;
        height: 36px;
        margin-top: 31px;
      }
    }
  }
}
</style>
